package sctu.edu.java.year2016.team04.yanghuilin.day20160525.chapter7_3;

/**
 * Created by dell on 2016/5/25.
 * 根据运行参数的个数决定循环打印变量i值的次数。
 */
public class Seven_Three {
    public static void main(String[] args) {
        String s = new String("Have a good night.");
        int i = 0;
        int t = s.indexOf(" ");
        String[] a = s.split(" ");
        for(i = 0;i < a.length;i++){
            if(t != 0)
                i++;
            else{
                i++;
                if(t != 0 )
                    i++;
                else
                    return;
            }
        }
        System.out.println("循环次数i为" +i);
    }
}
